<%@page import="Model.Friend.FriendList"%>
<%@page import="RssEasy.Core.HttpRequestHelper"%>
<%@page import="Model.Supplier.SupplierUserView"%>
<%@page import="Model.Supplier.SupplierExcellentView"%>
<%@page import="Model.Supplier.SupplierList"%>
<%@page import="java.util.Calendar"%>
<%@page import="Model.Purchase.PurchaseListView"%>
<%@page import="Model.Purchase.PurchaseList"%>
<%@page import="Model.Banner.BannerList"%>
<%@page import="RssEasy.Core.HttpExtend"%>
<%@page import="RssEasy.Core.GraphicsExtend.WaterMarkPosition"%>
<%@page import="java.awt.Color"%>
<%@page import="RssEasy.Core.DirectoryExtend"%>
<%@page import="RssEasy.Core.GraphicsExtend.ZoomMode"%>
<%@page import="RssEasy.Core.GraphicsExtend"%>
<%@page import="RssEasy.Core.DateTimeExtend"%>
<%@page import="RssEasy.Core.StringExtend"%>
<%@page import="RssEasy.Core.CookieHelper"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>企企通-首页</title>
        <link href="/css/reset.css" rel="stylesheet" type="text/css"/>
        <link href="/inc/header.css" rel="stylesheet" type="text/css"/>
        <link href="/inc/footer.css" rel="stylesheet" type="text/css"/>
        <link href="css/index.css" rel="stylesheet" type="text/css"/>
    </head>
    <body id="home">
        <%@include file="/inc/header.jsp"%>
        <ul id="account">
            <!--轮播图-->
            <li>
                <div id="banner">
                    <ul>
                        <%  BannerList banner = new BannerList(pageContext);
                            banner.select().get_page_desc("id");
                            while (banner.for_in_rows()) {
                        %>
                        <li><a href="<%=banner.get("link")%>"><img src="http://sys.qqt.itemjia.com/upfile/<%=banner.get("imgPath")%>" alt=""/></a></li>
                                <%
                                    }
                                %>
                    </ul>                    
                    <ol id="dot">
                        <li class="red"></li>
                        <li></li>
                        <li></li>
                    </ol>
                </div>
                <!--企业logo-->
                <div id="merchant">
                    <% for (int i = 0; i < 12; i++) {%>
                    <a><img src="testimg/enterprise.jpg" alt=""/></a>
                        <% } %>
                </div>                              
                <!--登录以及注册按钮-->
            <li id="merchant_two">
                <ul>
                    <li id="merchant_li">
                        <p>今日项目数</p>
                        <%
                            PurchaseList pelt = new PurchaseList(pageContext);
                            pelt.request();
                            int y = (int) (DateTimeExtend.timestamp() - (Calendar.HOUR_OF_DAY) * 60 * 60);
                            pelt.select("count(*) as total").where("shijian>" + y + "").get_first_rows();
                        %>
                        <div><% pelt.write("total"); %></div>
                        <span>目前累计数量</span>
                        <%
                            pelt.select("count(*) as total").get_first_rows();
                        %>
                        <b id="totalnum"><% pelt.write("total"); %></b>
                    </li>                    
                    <li id="merchant_li2">                      
                        <a href="login/login.jsp">登录</a>
                        <a href="login/register.jsp">免费注册</a>                      
                    </li>
                    <li id="merchant_li3">                       
                        <div id="merchant_li3_div"><a href="/my/Index"> <img src="testimg/icon.gif" alt=""/></a></div>
                        <p>用户：</p><span></span>
                        <br>
                        <b>欢迎来到企企通</b>
                    </li>                   
                </ul>
                <!--发布寻源内容-->
                <div id="merchant_div">              
                    <a href="">发布寻源内容</a>
                    <a href="/purchase/create">发布询比价</a>                
                </div>
                <!--发布最新内容-->
                <div id="merchant_div1">
                    最新发布
                </div>
                <!--消息列表-->
                <%
                    pelt.pagesize = 5;
                    pelt.select().get_page_desc("id");
                    while (pelt.for_in_rows()) {
                %>
                <a href="/purchase/details/<%=pelt.get("id")%>" target="_blank"><b><%pelt.write("name");%></b><span dateformat="<%=pelt.get("shijian")%>"></span></a>
                        <%
                            }
                        %>
            </li>
        </ul>
        <div id="entirety">
            <!--采购项目-->
            <form>
                <div id="procurement">
                    项目采购：<span>共有项目<span class="procurement_blue"><% pelt.write("total"); %></span>个</span>
                    <div>项目类别：
                        <button id="procurement_button" type="button">查询</button>
                        <select id="procurement_select">
                            <option value ="1">工业</option>
                            <option value ="2">木材</option>
                            <option value="3">钢材</option>                       
                        </select>
                    </div>
                </div>
            </form>
            <!--展示列表-->  
            <table id="list">
                <thead>
                    <tr>
                        <th class="project">项目名称</th>
                        <th class="enterprise">核心企业名称</th>
                        <th>截止时间</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody id="changelist">
                    <%
                        PurchaseListView list = new PurchaseListView(pageContext);
                        list.select().where("state=1 or state=2").get_page_desc("id");
                        long day = System.currentTimeMillis() / 1000;
                        Integer enddt = 0;
                        while (list.for_in_rows()) {
                            enddt = Integer.parseInt(list.get("enddt"));
                            long surplus = (enddt - day) / 86400;
                            if (surplus > 0) {

                    %>
                    <tr>
                        <td purname><%=list.get("name")%></td>
                        <td corpname><%=list.get("corpname")%></td>
                        <td enddt>还剩<%=surplus%>天</td>
                        <td oper><a href="/purchase/details/<%=list.get("id")%>" target="_blank">立即报价</a></td>
                    </tr>
                    <% } else {%>
                    <tr>
                        <td purname><%=list.get("name")%></td>
                        <td corpname><%=list.get("corpname")%></td>
                        <td enddt rssdate="<%=list.get("enddt")%>,yyyy-MM-dd"></td>
                        <td oper><a>已结束</a></td>
                    </tr>
                    <%}
                        }%>
                </tbody>
            </table>
            <div id="table_div">
                <a id="change">——换一批——</a><a href="/purchase/list" id="more">查看更多》</a>
            </div>          
            <!--友情链接-->
            <div id="link">
                友情链接：
                <%                    FriendList friend = new FriendList(pageContext);
                    friend.select().query();
                    while (friend.for_in_rows()) {
                %>
                <a href="<%out.print(friend.get("site"));%>"><%out.print(friend.get("net"));%></a>&nbsp;|&nbsp;
                <%
                    }
                %>
            </div>
            <!--供应商展示--> 
            <%
                SupplierList sup = new SupplierList(pageContext);
                sup.select("count(*) as num").get_first_rows();
            %>
            <form action="" method="post">
                <div id="shop">
                    供应商展示：<span>企企通共驻商家<span class="shop_blue"><%out.print(sup.get("num"));%></span>家</span>
                    <div>供应商查询：<input name="suppliers" placeholder="输入供应商名称"/><button id="shop_button" type="submit" >查询</button></div>
                </div>
            </form>
            <!--供应商详细展示-->
            <ul id="minute">
                <!--商家信誉-->
                <li id="minute_li">
                    <%
                        SupplierExcellentView suv = new SupplierExcellentView(pageContext);
                        suv.pagesize = 14;
                        suv.select().get_page_desc("myid");
                        for (int i = 0; i < 4; i++) {
                            suv.for_in_rows();
                    %>
                    <a href="">
                        <div>
                            <p><img src="testimg/enterprise.jpg" alt=""/></p>
                            <span><%out.print(suv.get("corpname"));%></span>
                            <br>                                   
                            <span class="abc">诚信等级：<img src="img/huangguan.png" alt=""/><img src="img/huise.png" alt=""/></span>
                            <div class="minute_li_div">
                                <div>注册资金：<span><%out.print(suv.get("yong"));%></span><span></span></div>
                                <div>所属行业：<span><%out.print(suv.get("name"));%></span></div>
                                <div>所属地区：<span area="<%out.print(suv.get("shengid"));%>,<%out.print(suv.get("shiid"));%>,<%out.print(suv.get("xianid"));%>" dict-split="&nbsp;">></span></div>
                                <div>主营产品：<span><%out.print(suv.get("mainproducts"));%></span></div>
                            </div>
                        </div>
                    </a>
                    <%   } %>
                </li>
                <!--优秀供应商-->
                <li id="minute_li2">
                    <p>优秀供应商排行榜</p>
                    <%
                        int i = 0;
                        while (suv.for_in_rows()) {
                            i++;
                    %>
                    <a href=""><span class="r<%=i%>"><%=i%></span><% out.print(suv.get("corpname")); %></a>
                        <%
                            }
                            banner.close();
                            pelt.close();
                            list.close();
                            friend.close();
                            sup.close();
                            suv.close();
                        %>
                </li>
            </ul>
        </div>
        <%@include file="/inc/footer.jsp"%>
        <%@include file="/inc/js_all.html"%>
        <script src="js/arealist.js" type="text/javascript"></script>
        <script src="data/dictdata.js" type="text/javascript"></script>
        <script type="text/javascript">
            dictdata['area'] = AreaListData;
        </script>
        <script src="js/rsseasy.map.js" type="text/javascript"></script>
        <script src="/data/channel.js" type="text/javascript"></script>
        <script src="js/index.js" type="text/javascript"></script>
    </body>
</html>
